<template>
	<view>
		<view class="item-content">
			<view class="item" v-for="(item,i) in payHistoryData" :key="i">
				<view class="top">
					<view class="left">
						支付时间:{{item.consumption_time}}
					</view>
					<view class="right">
						金额:{{item.consumption_amount}}元
					</view>
				</view>
				<view class="center">
					{{item.description}}
				</view>
				<view class="bottom">
					订单编号：{{item.consumption_no}}
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from "vue"

	import {
		onLoad,
		onUnload
	} from '@dcloudio/uni-app'
	import {
		getPayHistoryList,
		getOpenId
	} from '../../api/api.js'

	const payHistoryData = ref([])


	const getOpenIdWebView = () => {
		uni.getStorage({
			key: 'openid',
			success: function(res) {

				getPayHistoryList(res.data.openid).then((res3) => {
					console.log(res3);
					payHistoryData.value = res3.values
				})
			}
		});
	}

	onLoad(() => {
		getOpenIdWebView()
	})
</script>

<style lang="scss" scoped>
	.item-content {
		padding: 10px 20px;

		.item {
			margin-top: 20px;
			padding: 10px;
			border: 1px solid gainsboro;
			border-radius: 10px;

			.top {
				display: flex;
				justify-content: space-between;
			}
		}
	}
</style>